﻿using System;

namespace YFurion.Attributes
{
    [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
    public class CustomAuthorizeAttribute : Attribute
    {
        public string Codes { get; }

        public string[] CodeArray
        {
            get
            {
                return string.IsNullOrWhiteSpace(Codes) ?
                    new string[0] : Codes.Split(',', StringSplitOptions.RemoveEmptyEntries);
            }
        }

        public CustomAuthorizeAttribute(string codes)
        {
            this.Codes = codes;
        }
    }
}
